unit RelatorioChequePre;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UFormRelatorio, DB, DBTables, QRCtrls, QuickRpt, ExtCtrls,
  StdCtrls;

type
  TFRelatorioChequePre = class(TFormRelatorio)
    QRBand2: TQRBand;
    QRLabel5: TQRLabel;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    QRLabel8: TQRLabel;
    QRLabel9: TQRLabel;
    QRLabel10: TQRLabel;
    QRLabel11: TQRLabel;
    QRLabel12: TQRLabel;
    QRDBText1: TQRDBText;
    QRDBText2: TQRDBText;
    QRDBText3: TQRDBText;
    QRDBText4: TQRDBText;
    QRDBTCPF: TQRDBText;
    QRDBText6: TQRDBText;
    QRDBText7: TQRDBText;
    QRDBText8: TQRDBText;
    QRBand3: TQRBand;
    QRExpr1: TQRExpr;
    QRShape2: TQRShape;
    QRLCPFCNPJ: TQRLabel;
    procedure QRBand2BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure FormCreate(Sender: TObject);
    procedure QRBand1BeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FRelatorioChequePre: TFRelatorioChequePre;
  S :String;
implementation

uses UGeral;


{$R *.dfm}

procedure TFRelatorioChequePre.QRBand2BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
  inherited;
 S:=QRelatorio.FieldByName('CPFCNPJ').AsString;
 if Length(s) <= Tam then
  begin
   insert('.',s,4);
   insert('.',s,8);
   insert('-',s,12);
  end
 else
  Begin
   insert('.',s,3);
   insert('.',s,7);
   insert('/',s,11);
   insert('-',s,16);
  end;
 QRLCPFCNPJ.Caption:=s;

end;

procedure TFRelatorioChequePre.FormCreate(Sender: TObject);
begin
  inherited;
 Q:=TQuery.Create(Self);
 q.DatabaseName:=QRelatorio.DatabaseName;
 q.Close;
 q.SQL.Clear;
 q.SQL.Add('Select Emp_Razao as Razao from empresa ');
 q.SQL.Add('Where Emp_Codigo = :Cod ');
 q.ParamByName('Cod').AsInteger:=Codigoempresa;
 q.Open;
 QRLNomeEmpresa.Caption:=q.fieldByname('Razao').AsString;

end;

procedure TFRelatorioChequePre.QRBand1BeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);
begin
  inherited;
 QRLabel4.Top:=95;
 QRLabel4.Left:=5;

 QRLData.Top:=95;
 QRLData.Left:=5;

end;

end.
